package com.heima.feign.api.article;

import com.heima.feign.config.FeignConfiguration;
import com.heima.model.aritlce.dto.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dto.PageSearchArticleDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "leadnews-article", configuration = FeignConfiguration.class)
public interface ArticleFeignClient {

    /**
     * 新增文章
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/article/save")
    ResponseResult saveArticle(@RequestBody ArticleDto dto);

    /**
     * 修改文章上下架状态
     * @param articleId
     * @param enable
     * @return
     */
    @PutMapping(path = "/api/v1/article/{articleId}/{enable}")
    public ResponseResult<Void> updateEnableStatus(@PathVariable("articleId") Long articleId, @PathVariable("enable") Integer enable);

    /***
     * 批量导入分页查询数据接口
     */
    @GetMapping("/api/v1/article/importData/{page}/{size}")
    PageSearchArticleDto pageData(@PathVariable("page")Integer page, @PathVariable("size")Integer size);
}
